<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
		<link href="../css/sfmain.css" rel="stylesheet" type="text/css"></link>
		<script src="../js/jquery-1.11.3.min.js"></script>
		<script src="../js/common.js"></script>
<!--		<script src="../js/sqlite.js"></script>-->
<!--		<script src="../js/lnmxzqgy.js"></script>-->
		<script>
		$(function() {
			selectNewData();
		 });
		function saveInfo(){
				//createtable();
				var happentime = $("#happentime").val();//随访日期
				var visityType = $("input[name='sffs']:checked").val();//随访方式
				var sfbr = $("input[name='sfbr']:checked").val();//是否本人
				var tgrgx = $("#tgrgx").val();//提供信息者与被访人关系
				 var zz = "";//症状
				$('input:checkbox[name=zz]:checked').each(function (i) {
					if (0 == i) {
						zz = $(this).val();
					} else {
						zz += ("," + $(this).val());
					}
				});
				var zzqt = $("#zzqt").val();//症状其他
				var gy = $("#gy").val();//高压
				var dy = $("#dy").val();//低压
				var weight = $("#weight").val();//体重
				var heart = $("#heart").val();//心率
				var hx = $("#hx").val();//呼吸
				var tzqt = $("#tzqt").val();//体征其他
				var sfjy = $("input[name='sfjy']:checked").val();//是否戒烟
				var sfjj = $("input[name='sfjj']:checked").val();//是否戒酒
				var ydcs = $("#ydcs").val();//运动次数
				var ydsc = $("#ydsc").val();//运动时长
				var ysqk = "";//饮食情况
				$('input:checkbox[name=ysqk]:checked').each(function (i) {
					if (0 == i) {
						ysqk = $(this).val();
					} else {
						ysqk += ("," + $(this).val());
					}
				});
				var xltz = $("input[name='xltz']:checked").val();//心里调整
				var zyxw = $("input[name='zyxw']:checked").val();//遵医行为
				var fyycx = $("input[name='fyycx']:checked").val();//服药依从性
				var ywblfy = $("input[name='ywblfy']:checked").val();//药物不良反应
				var ywmc1 = $("#ywmc1").val();//药物名称1
				var mr1 = $("#mr1").val();//每日1
				var mc1 = $("#mc1").val();//每次1
				var ywmc2 = $("#ywmc2").val();//药物名称2
				var mr2 = $("#mr2").val();//每日2
				var mc2 = $("#mc2").val();//每次2
				var ywmc3 = $("#ywmc3").val();//药物名称3
				var mr3 = $("#mr3").val();//每日3
				var mc3 = $("#mc3").val();//每次3

				var sffl = $("input[name='sffl']:checked").val();//此次随访分类
				var sfys = $("#sfys").val();//随访医生
				var insertsql = "insert into mxzqgy(id,personid,name,sex,happentime,visityType,sfbr,tgrgx,zz,zzqt,gy,dy,weight,heart,"
									+"hx,tzqt,sfjy,sfjj,ydcs,ydsc,ysqk,xltz,zyxw,fyycx,ywblfy,ywmc1,mr1,mc1,ywmc2,mr2,mc2,ywmc3,mr3,mc3,sffl,sfys) values("
								+"'"+Math.floor(Math.random()*10)+"',"
								+"'"+personid+"',"
								+"'"+name+"',"
								+"'"+sex+"',"
								+"'"+happentime+"',"
								+"'"+visityType+"',"
								+"'"+sfbr+"',"
								+"'"+tgrgx+"',"
								+"'"+zz+"',"
								+"'"+zzqt+"',"
								+"'"+gy+"',"
								+"'"+dy+"',"
								+"'"+weight+"',"
								+"'"+heart+"',"
								+"'"+hx+"',"
								+"'"+tzqt+"',"
								+"'"+sfjy+"',"
								+"'"+sfjj+"',"
								+"'"+ydcs+"',"
								+"'"+ydsc+"',"
								+"'"+ysqk+"',"
								+"'"+xltz+"',"
								+"'"+zyxw+"',"
								+"'"+fyycx+"',"
								+"'"+ywblfy+"',"
								+"'"+ywmc1+"',"
								+"'"+mr1+"',"
								+"'"+mc1+"',"
								+"'"+ywmc2+"',"
								+"'"+mr2+"',"
								+"'"+mc2+"',"
								+"'"+ywmc3+"',"
								+"'"+mr3+"',"
								+"'"+mc3+"',"
								+"'"+sffl+"',"
								+"'"+sfys+"'"
								+")";
			var jg = app.InsertSql(insertsql);
			if("success"==jg){
				alert("操作成功！");
			}

}

	function selectNewData(){
			var selectsql = 'select * from mxzqgy where personid='+personid+" order by happentime desc";
			var data = app.getInfo5(selectsql);
			var obj = eval('(' + data + ')');
			if(null!=obj&&obj.length>0){
				var info = obj[0];
				$("#xm").html(info.name);
				$("#xb").html(info.sex);
				$("#happentime").val(info.happentime);//随访日期
				$("input[name=sffs]:eq("+info.visityType+")").attr("checked",'checked');//随访方式
				$("input[name=sfbr]:eq("+info.sfbr+")").attr("checked",'checked');//是否本人
				$("#tgrgx").val(info.tgrgx);//提供信息者与被访人关系
				var zz = info.zz;//症状
				if(null!=zz&&zz.length>0){
					$(zz.split(",")).each(function (i,e){
						$("input[name='zz'][value='"+e+"']").prop("checked",true);
					});
				}
				$("#zzqt").val(info.zzqt);//症状其他
				$("#gy").val(info.gy);//高压
				$("#dy").val(info.dy);//低压
				$("#weight").val(info.weight);//体重
				$("#heart").val(info.heart);//心率
				$("#hx").val(info.hx);//呼吸
				$("#tzqt").val(info.tzqt);//体征其他
				$("input[name=sfjy]:eq("+info.sfjy+")").attr("checked",'checked');//是否戒烟
				$("input[name=sfjj]:eq("+info.sfjj+")").attr("checked",'checked');//是否戒酒
				$("#ydcs").val(info.ydcs);//运动次数
				$("#ydsc").val(info.ydsc);//运动时长
				var ysqk = info.ysqk;//饮食情况
				if(null!=ysqk&&ysqk.length>0){
					$(ysqk.split(",")).each(function (i,e){
						$("input[name='ysqk'][value='"+e+"']").prop("checked",true);
					});
				}
				$("input[name=xltz]:eq("+info.xltz+")").attr("checked",'checked');//心里调整
				$("input[name=zyxw]:eq("+info.zyxw+")").attr("checked",'checked');//遵医行为
				$("input[name=fyycx]:eq("+info.fyycx+")").attr("checked",'checked');//服药依从性
				$("input[name=ywblfy]:eq("+info.ywblfy+")").attr("checked",'checked');//药物不良反应
				$("#ywmc1").val(info.ywmc1);//药物名称1
				$("#mr1").val(info.mr1);//每日1
				$("#mc1").val(info.mc1);//每次1
				$("#ywmc2").val(info.ywmc2);//药物名称2
				$("#mr2").val(info.mr2);//每日2
				$("#mc2").val(info.mc2);//每次2
				$("#ywmc3").val(info.ywmc3);//药物名称3
				$("#mr3").val(info.mr3);//每日3
				$("#mc3").val(info.mc3);//每次3
				$("input[name=sffl]:eq("+info.sffl+")").attr("checked",'checked');//此次随访分类
				 $("#sfys option[value='"+info.sfys+"']").attr("selected","selected");//随访医生
			}

		}
		function fbcscli(val){
            if("1"==val){
                $("#fbcs").attr("disabled",false);
            }else{
                 $("#fbcs").attr("disabled",true);
            }
        }
		</script>
	</head>
	<body>
		<div class="dh">
			<div class="dhleft">
				<span>重型老年慢性支气管炎随访记录表</span>
			</div>
			<div class="bc" onclick="saveInfo()">
				<img  class="bcimg" src="../img/icon-save.png"/>
				<span class="bcspan">保存</span>
			</div>
		</div>
		<div class="maindiv">
			<div class="sfxx">
				<span class="sfxxspan">随访信息</span>
			</div>
			<div>
				<hr class="titleline" />
			</div>
			<div class="titlaspan">
				<span>基本信息</span>
      </div>
      <div class="titlebody">
        <div>
			<span class="span1">姓名：</span>
			<span  id="xm" style="margin-left:5px;"></span>
			<span class="span1" style="margin-left: 100px;" >性别：</span>
			<span  id="xb" style="margin-left:5px;"></span>
        </div>
        <div>
          <span class="span1">随访日期：</span>
          <input class="timeinput" id="happentime" type="date"/>
          
        </div>
		<div>
		  <span class="span1" >随访方式：</span>
		  <input class="radio_type" type="radio" value="1" name="sffs" id="sffs1" checked="checked"/>
		  <label for="sffs1">门诊</label>
		  <input class="radio_type" type="radio" value="2" name="sffs" id="sffs2" /> 
		  <label for="sffs2">家庭</label>
		  <input class="radio_type" type="radio" value="3" name="sffs" id="sffs3" />
		  <label for="sffs2">通过电话或者手机短信（微信）联系患者本人或者家人</label><br>
			<input class="radio_type" type="radio" style="margin-left: 105px;" value="4" name="sffs" id="sffs4" />
		  <label for="sffs4">其他地方进行面对面教育</label>
		  <input class="radio_type" type="radio" value="5" name="sffs" id="sffs5" />
		  <label for="sffs5">其他</label>
		</div>
        <div>				
          <span class="span1">是否本人：</span>
          <input class="radio_type" type="radio" onchange="sfbrcha(this.value)" name="sfbr" value="0" id="sfbr1" checked="checked"/>
          <label for="sfbr1">是</label>
          <input class="radio_type" type="radio" onchange="sfbrcha(this.value)" name="sfbr" value="1" id="sfbr2" />
          <label for="sfbr2">否</label>
          <span class="span1" style="width:auto;">提供信息者与被调查人直接的关系：</span>
          <input type="text" class="inputcss" id="tgrgx"/>
        </div>
       
      </div>
	  
		<div class="titlaspan">
		<span>症状</span>
      </div>

      <div class="titlebody">
        <div>
			<ul>
				<li>
					<input type="checkbox" class="inputbox" value="1" name="zz" id="zz1"/>
					1无症状
				</li>
				<li>
					<input type="checkbox" class="inputbox" style="margin-left: 30px;padding-left:36px;" value="2" name="zz" id="zz2"/>
					2咳嗽
				</li>
				<li>
					<input type="checkbox" class="inputbox" value="3" style="margin-left: 30px;padding-left:36px;" name="zz" id="zz3"/>
					3咳痰
				</li>
				<li>
					<input type="checkbox" class="inputbox" value="4" style="margin-left: 30px;padding-left:36px;" name="zz" id="zz4"/>
					4喘息
				</li>
			</ul>
			<ul>
				<li>
					<input type="checkbox" class="inputbox" value="5" name="zz" id="zz5"/>
					5&nbsp;&nbsp;气&nbsp;&nbsp;急
				</li>
				<li>
					<input type="checkbox" class="inputbox" onclick="zzqt(this.value)" style="margin-left: 30px;padding-left:36px;" value="5" name="zz" id="zz6"/>
					6其他
					<input type="text" class="inputcss" id="zzqt" style="width: 200px;"/>
				</li>
			</ul>

        </div>
       
      </div>
	  <div class="titlaspan">
	  		<span>体征</span>
	  </div>
	  <div class="titlebody">
		<div >
			<span class="span1">血压(mmHg)：</span>
			<input type="number" class="inputcss" placeholder="高压"  style="width: 40px;" id="gy"/><span class="dw">/</span>
			<input type="number"  placeholder="低压"  class="inputcss"  style="width: 40px;"    id="dy"/>
			<span class="span2">体重(kg)：</span>
	        <input type="number" class="inputcss" style="width: 40px;"  id="weight"/>
			<span class="span2">心率(次/分)：</span>
			<input type="number" class="inputcss" style="width: 40px;"  id="heart"/>
	    </div>
		<div>
			<span class="span1">呼吸：</span>
			<input type="number" class="inputcss"  id="hx"/>
			<span class="span2">其他：</span>
			<input type="text" class="inputcss"  id="tzqt" style="width: 150px;"/>
		</div>
	  </div>
	  <div class="titlaspan">
	  	<span>生活方式指导</span>
	  </div>
	  <div class="titlebody">
		<div>
			<span class="span1" style="width:auto">戒烟：</span>
			<input class="radio_type" type="radio" value="0" name="sfjy" id="sfjy1"/>
			<label for="sfjy1">是</label>
			<input class="radio_type" type="radio" value="1" name="sffy" id="sfjy2" /> 
			<label for="sfjy2">否</label>
			<span class="span2" style="width:auto">戒酒：</span>
			<input class="radio_type" type="radio" value="0" name="sfjj" id="sfjj1"/>
			<label for="sfjj1">是</label>
			<input class="radio_type" type="radio" value="1" name="sfjj" id="sfjj2" /> 
			<label for="sfjj2">否</label>
		</div>
		  <div>
			<span class="span1">运动：</span>
			<input type="number" class="inputcss" style="width: 50px;" id="ydcs"/><span class="dw">次/周</span>
			<input type="number" class="inputcss" style="width: 50px;" id="ydsc"/><span class="dw">分钟/次</span>
		</div>
		<div>			
			<span class="span1">饮食情况：</span>
			<input type="checkbox" class="inputbox" value="1" name="ysqk"/>
			规律饮食
			  <input type="checkbox" class="inputbox" value="2" name="ysqk"/>
			  清淡饮食
			  <span class="span2">心理调整：</span>
			  <input class="radio_type" type="radio" value="1" name="xltz" id="xltz1"  checked="checked"/>
			  <label for="xltz1">良好</label>
			  <input class="radio_type" type="radio" value="2" name="xltz" id="xltz2"/> 
			  <label for="xltz2">一般</label>
			  <input class="radio_type" type="radio" value="3" name="xltz" id="xltz3"/>
			  <label for="xltz3">差</label>
		  </div>
		  <div>
		  <span class="span1">遵医行为：</span>
		  <input class="radio_type" type="radio" value="1" name="zyxw" id="zyxw1"  checked="checked"/>
		  <label for="zyxw1">良好</label>
		  <input class="radio_type" type="radio" value="2" name="zyxw" id="zyxw2"/> 
		  <label for="zyxw2">一般</label>
		  <input class="radio_type" type="radio" value="3" name="zyxw" id="zyxw3"/>
		  <label for="zyxw3">差</label>
		 </div>

	  </div>
	  <div class="titlaspan">
	  	<span>用药情况</span>
	  </div>
	  <div class="titlebody">
		  <div>
			  <span class="span1">服药依从性：</span>
			  <input class="radio_type" type="radio" value="1" name="fyycx" id="fyycx1"/>
			  <label for="fyycx1">规律</label>
			  <input class="radio_type" type="radio" value="2" name="fyycx" id="fyycx2" /> 
			  <label for="fyycx2">间断</label>
			  	<input class="radio_type" type="radio" value="3" name="fyycx" id="fyycx3" />
			  	<label for="fyycx3">不服药</label>
		    <span class="span2" style="width:auto">药物不良反应：</span>
		    <input class="radio_type" type="radio" value="0" name="ywblfy" id="ywblfy1"/>
		    <label for="ywblfy1">有</label>
		    <input class="radio_type" type="radio" value="1" name="ywblfy" id="ywblfy2" />
		    <label for="ywblfy2">无</label>
		   
		  </div>
	  </div>
	  <div >
		   <span class="span2">近期药物使用情况</span>
	  </div>
		<div class="titlebody">
		  <div>
			  <span class="span1">药物名称1：</span>
			  <input type="text" class="inputcss" id="ywmc1" style="width: 120px;"/>
			  <span class="span2">用法：每日：</span>
			  <input type="number" class="inputcss" id="mr1" style="width: 30px;"/><span class="dw">次</span>
			  <span class="span2">每次：</span>
			  <input type="number" class="inputcss" id="mc1" style="width: 30px;"/>
		  </div>
		  <div>
			  <span class="span1">药物名称2：</span>
			  <input type="text" class="inputcss" id="ywmc2" style="width: 120px;"/>
			  <span class="span2">用法：每日：</span>
			  <input type="number" class="inputcss" id="mr2" style="width: 30px;"/><span class="dw">次</span>
			  <span class="span2">每次：</span>
			  <input type="number" class="inputcss" id="mc2" style="width: 30px;"/>
		  </div>
		  <div>
			  <span class="span1">药物名称3：</span>
			  <input type="text" class="inputcss" id="ywmc3" style="width: 120px;"/>
			  <span class="span2">用法：每日：</span>
			  <input type="number" class="inputcss" id="mr3" style="width: 30px;"/><span class="dw">次</span>
			  <span class="span2">每次：</span>
			  <input type="number" class="inputcss" id="mc3" style="width: 30px;"/>
		  </div>

	  </div>
	  <div class="titlaspan">
	  	<span>此次随访分类</span>
	  </div>
	  <div class="titlebody">
		  <div>
			  <input class="radio_type" type="radio" value="0" name="sffl" id="sffl1"/>
			  <label for="sffl1">1控制满意</label>
			  <input class="radio_type" type="radio" value="2" name="sffl" id="sffl2"/>
			  <label for="sffl2">2控制不满意</label>
			  <input class="radio_type" type="radio" value="3" name="sffl" id="sffl3"/>
			  <label for="sffl3">3不良反应</label>
			  <input class="radio_type" type="radio" value="4" name="sffl" id="sffl4"/>
			  <label for="sffl4">4并发症</label>
		  </div>
	  </div>
	  <div  class="titlebody">
	    <span class="span1">随访医生：</span>
		  <select class="inputcss"   id="sfys">

		  </select>
	  </div>
	 
	</div>
	</body>
</html>
